package com.CGFrame.struts.action;

import java.util.LinkedList;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.apache.struts.action.Action;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;

import com.CGFrame.struts.bean.UserLogin.LoginBean;
import com.CGFrame.struts.bean.project.ProjectBean;
import com.CGFrame.struts.bean.reguser.ReguserBean;

public class ChangeProjectAction extends Action {

	@Override
	public ActionForward execute(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception {
		String proId=request.getParameter("proId");
		request.getSession().setAttribute("ProjectID",proId);
		ProjectBean pj=new ProjectBean(proId);
		String proName=pj.getProjectName();
		request.setAttribute("proName", proName);
		
		
		String regUserId = (String)request.getSession().getAttribute("RegUserID");
		ReguserBean rb=new ReguserBean(regUserId);
		request.setAttribute("ReguserName", rb.getReguserName());
		LoginBean lb = new LoginBean(regUserId);
		LinkedList lnlist=lb.getProjectIds();
		request.setAttribute("pros", lnlist);
		return mapping.findForward("main");
	}
	
}
